﻿
using System;
using System.Collections.Generic;

namespace test.kafka
{
    /// <summary>
    /// MQ消息接口
    /// </summary>
    public interface IEventMessage
    {
        /// <summary>
        /// 动作
        /// </summary>
        string Action { get; set; }
        /// <summary>
        /// 消息体
        /// </summary>
        string Body { get; set; }
        /// <summary>
        /// 消息标签
        /// </summary>
        string Tag { get; set; }
        /// <summary>
        /// 自定义参数项
        /// </summary>
        IDictionary<string, string> Data { get; }
        /// <summary>
        /// 消息时间
        /// </summary>
        /// <value>The event time.</value>
        DateTime CreateTime { get; set; }
    }

    /// <summary>
    /// 消息数据
    /// </summary>
    /// <seealso cref="MQ.IMQMessageBase" />
    [Serializable]
    public class EventMessage : IEventMessage
    {
        private readonly IDictionary<string, string> data = new Dictionary<string, string>();
        public string Action { get; set; }
        public string Body { get; set; }
        public string Tag { get; set; }
        public IDictionary<string, string> Data => data;
        public DateTime CreateTime { get; set; }

        public EventMessage()
        {
            CreateTime = DateTime.Now;
        }
    }

    /// <summary>
    /// 消息事件处理器
    /// </summary>
  
}
